﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XingZhe.Common; 

namespace XingZhe.LocationListeners
{
        public class LocationRecordListener : IDisposable, IPositionChanged
        {
                private string workoutSectionId;
                public LocationRecordListener(string sectionId)
                {
                        this.workoutSectionId = sectionId;
                }

                public void Dispose()
                {

                }

                public void PositionChanged(Windows.Devices.Geolocation.Geolocator geolocator, Windows.Devices.Geolocation.PositionChangedEventArgs args)
                { 
                        //BusinessContext.TrackPointContext.AddTrackPoint(new TrackPoint()
                        //{
                        //        Altitude = args.Position.Coordinate.AltitudeAccuracy < 8 ? args.Position.Coordinate.Altitude : null,
                        //        Heading = args.Position.Coordinate.Heading,
                        //        WorkoutSectionId = this.workoutSectionId,
                        //        Latitude = args.Position.Coordinate.Latitude,
                        //        Longitude = args.Position.Coordinate.Longitude,
                        //        Speed = args.Position.Coordinate.Speed,
                        //        DateTime = DateTime.Now,
                        //        TrackPointId = Guid.NewGuid().ToString()
                        //});

                        //Debug.WriteLine("记录");
                }
        }
}
